

void OHOS_SystemInit(void);

void LittlefsInit(void)
{
#define DIR_DATA "/data"
#define PAR_DATA 0
#define DIR_PERMISSIONS 0777

    int res;

    printf("LittleFS_Init \r\n");

    struct PartitionCfg *cfg = LittlefsConfigGet();

    res = mount(PAR_DATA, DIR_DATA, "littlefs", 0, cfg);
    printf("mount = %d\r\n", res);

    struct stat sinfo;
    if (!(stat(DIR_DATA, &sinfo) == 0 && S_ISDIR(sinfo.st_mode))) {
        res = mkdir(DIR_DATA, DIR_PERMISSIONS);
        printf("mkdir = %d\r\n", res);
    }
}



void SystemInit(void)
{
    OHOS_SystemInit();
    LittlefsInit();
}
